Skip to content

sahinmeric/prueba_tecnica

Repository files navigation

Technical Test

This repo contains my solutions for the technical test provided by X.

Description

As described in pdf file prueba_tecnica. Given two problems with 20 json files in the following structure.
JSON file structure

{
    "name": "User 2",
    "modulos":
              {
              "content_module": "authz.provider_1",
              "auth_module": "authn.provider_2"
              }
}

These files indicate for each user, which modules must be loaded. In this case, the modules are authz.provider_1 and authn.provider_2.

Problems

Part A : We want to see which users are using which module.
The result must have the following format where the each module and the user of the module are indicated.
Expected output format

{
  'auth_module' : 
                  {
                    'authn.provider_1': ['./u1.json', './u2.json'],
                    'authn.provider_2': ['./u3.json', './u4.json', './u5.json']
                  },
  'content_module' : 
                    {
                      'authz.provider_1': ['./u1.json', './u3.json'],
                      'authz.provider_2': ['./u2.json', './u4.json'],
                      'authz.provider_3': ['./u5.json']
                    }
}

Part B : We also want to know which minimum user set is needed to be able to test all modules with the following format.
For example in the prior part u1, u4, u5 or u2, u3 ,u5 user sets will cover all present modules.
Expected output format

[‘./u1.json’, ‘./u4.json’, ‘./u5.json’]  
[‘./u2.json’, ‘./u3.json’, ‘./u5.json’]  

Solutions

I choose Python to write my scripts since I feel more comfortable with it. The solution of each part I took some steps to reach my final answer. Those steps are also included to this repo.
--- Part A ---
Steps: a1 --> a2 --> a3

Answer: part_a

--- Part B ---
Steps: b1 --> b2 --> b3 --> b4

Answer: part_b

I completed this test in 20 hours total, spending 3 or 4 hours a day for 5 days.

Getting Started

Dependencies

To run the scripts you must need Python 3.6 or above.

Installing

Windows --> Python Releases for Windows
Linux/UNIX*

$ sudo apt-get update
$ sudo apt-get install python3.6

Executing programs

$ git clone https://github.com/sahinmeric/prueba_tecnica.git
$ cd prueba_tecnica
$ python3 part_a.py
$ python3 part_b.py

Testing the programs

$ python3 test_part_a.py
$ python3 test_part_b.py

or

$ python3 -m unittest

Style guide checking

To check the style pycodestyle must be installed.

Installation

$ pip install pycodestyle

Usage

$ pycodestyle part_a.py part_b.py

Author

Sahin MERIC | LinkedIn | GitHub |

About

A completed technical test.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages