Git Product home page Git Product logo

api-platform-test-user's Introduction

api-platform-test-user

Download

This is a published API on the API Platform. It is the backend microservice for the creation of test users in the API Platform for the External Test Environment. Test users and organisations are stored in mongo.

It exposes endpoints as documented on the Developer Hub.

Running tests

Unit and integration tests can be run with the following bash script:

./run_all_tests.sh

Note that integration tests require a running version of Mongo 5.0, listening on localhost:27017. A simple way to achieve this is to run with a docker image:

docker run -p 27017:27017 --name mongo -d mongo:5.0

Creating a local test user

To create a local test user using a browser frontend, check out api-platform-test-user-frontend and follow its README.

To create a local test user without a frontend, first start the service by running run_local.sh.

A test individual can then be created with curl.

curl --location --request POST 'http://localhost:9617/individuals' \
--header 'Content-Type: application/json' \
--data-raw '{
  "serviceNames": [
    "national-insurance",
    "self-assessment",
    "mtd-income-tax",
    "customs-services",
    "goods-vehicle-movements",
    "mtd-vat",
    "common-transit-convention-traders"
  ],
  "eoriNumber": "GB123456789012"
}'

Test organisations and agents can be created similarly, using the respective endpoints in conf/app.routes.

Adding fields

  • In /app/uk/gov/hmrc/testuser/models/TestUser.scala
  • update TestUserPropKey to have your new key.
  • Use the new key inside of the generators.

License

This code is open source software licensed under the Apache 2.0 License

api-platform-test-user's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-platform-test-user's Issues

Linking an agent to their customer/client MTD account

JoeBloggs businessA with MTD account xxxxxxxxxxx has hired AgentB with agent MTD account 00000000000. How does AgentB post an MTD self-assessment transaction on behalf of their client JoeBloggs businessA?

Kind regards

Mathias

Getting 403 Forbidden when trying to create a user

This was working fine last night, but now when I'm trying to create a test user I'm getting the following

[
    {
        "status_code": 403,
        "status_str": "Forbidden",
        "url": "https://test-api.service.hmrc.gov.uk/create-test-user/organisations",
        "method": "POST",
        "xid": null,
        "result": {
            "code": "RESOURCE_FORBIDDEN",
            "message": "The application is not subscribed to the API which it is attempting to invoke"
        }
    }
]

I am of course subscribed to the "Create Test User" API...

Any idea's?

How to create a test user for automated testing?

HI,

Creating test users is fine, but you always have to go through the manual OAuth process. Then I noticed this line under the heading

What types of test user can I create? from the Create Test User API page.

"You can also create test users for use during automated testing"

Great! as I assume that means I can create a test user and hit some endpoints without needing any manual intervention. But how do I create such a user?

Sometimes I need to create test users in rapid fire succession to test stuff and having to go though the OAuth process each time really slows things down.

Either that or if there was way to reset a users state? I.e no periods created etc...

Cheers,
Andrew

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.