PySyft icon indicating copy to clipboard operation
PySyft copied to clipboard

[WIP] Notebook Login Flow Tests - Draft

Open shubham3121 opened this issue 3 years ago • 1 comments

Description

Test User Login Flow using Notebooks Test User Registration Flow using Notebooks

Type of Test

  • [ ] Unit test (e.g. checking a loop, method, or function is working as intended)
  • [ ] Integration test (e.g. checking if a certain group or set of functionality is working as intended)

Expected Behavior

A clear and concise description of what you expected to happen. Do you intend to reach a certain percentage of test coverage for this file, feature, or codebase?

Additional Context

Add any other context about the tests here.

shubham3121 avatar Mar 25 '22 05:03 shubham3121

Login Flow

User has the url to the domain

Successful login:

  • [ ] user calls syft.login
  • [ ] user enters in url to the domain
  • [ ] user enters in unique_email
  • [ ] user enters in valid_password
  • [ ] user enters in port if provided else uses a default port=80
  • [ ] user sees a success login message
    onnecting to <domain url>
    ogging into <domain name> Domain...  Logged in 🥳!!
    ogged in as <user email>
    
  • [ ] user receives an authenticated client object to the domain
  • [ ] syft version is different from syft version of the domain, a warning message is raised:
    *Warning**: The syft version on your system and the node are different.
    ersion on your system: <syft version on your system>
    ersion on the node: <syft version on the domain node>
    

User fills partial information:

  • [ ] user does not enter password, then prompt to enter password
    lease enter your password:
    ``	
    
  • [ ] user does not enter url, then prompt to enter port (If url is empty, we assume domain is running locally)
    lease specify the port of the domain you're logging into:
    

Unsuccessful login:

  • [ ] user enters invalid email or password, raise authentication error message
    uthentication Failed:
    Your email and password do not match. Please try again.
    
  • [ ] user enters invalid url/port or domain is offline, raise a connection error message
    onnecting to `<domain url>`
    
    onnectionError:
       Oops !!! We can't seem to find the domain you're looking for.
       Please try the following options:
       - Please check the `url`/`port` you entered are correct.
       - Please contact the source where you obtained the URL.
       - The domain node could be offline at the current moment. Please try again later.
    

Successful login as Guest User:

  • [ ] user enters in a valid url to the domain
  • [ ] user enters in port (otherwise default to 80)
  • [ ] user does not enter both email and password
  • [ ] login success message
    onnecting to <domain url>
    ogging into <domain name> Domain...  Logged in 🥳!!
    ogged in as GUEST USER
    
    xplore! See what datasets are on this domain by using the command:
    `data_scientist_node.datasets`
    
    hen you're ready to begin your data science project you can create an account by calling:
    `syft.register()`
    

User access a domain via the network

Successful login

  • [ ] user list all available networks
  • [ ] user selects a network
  • [ ] user lists all available domains on that network
  • [ ] user selects a domain and receives a proxy client to the domain in return
  • [ ] user calls .login with email and password as arguments
  • [ ] user sees a success login message
    ogging into Canada Domain...  Logged in 🥳!!
    ogged in as <user email>
    
  • [ ] user receives an authenticated client object to the domain

User fills partial information:

  • [ ] user does not enter password, then prompt to enter password
    lease enter your password:
    ``	
    
    

Unsuccessful login

  • [ ] user calls .login with invalid email or password
    uthentication Failed:
       Your email and password do not match. Please try again.
    
  • [ ] user selects a domain node from the network but the domain node is offline:
    onnectionError:
       Oops !!! We can't seem to find the domain you're looking for.
       Please try the following options:
       - The domain node could be offline at the current moment. Please try again later.
    
  • [ ] user selects a network node but the network node is offline
    onnectionError:
       The network node seems to be offline at the current moment.
       Please contact [email protected] for further assistance.
    

Successful login as Guest User:

  • [ ] user list all available networks
  • [ ] user selects a network
  • [ ] user lists all available domains on that network
  • [ ] user selects a domain and receives a proxy client to the domain in return
  • [ ] user calls .login without passing email and password as arguments
  • [ ] user sees a success login message
    ogging into Canada Domain...  Logged in 🥳!! 
    ogged in as GUEST USER
    
    xplore! See what datasets are on this domain by using the command: 
       `data_scientist_node.datasets`
    
    hen you're ready to begin your data science project you can create an account by calling:
       `network = sy.networks[0]` # Select your network
       `domain_proxy_client = network.domains[0]` # Select the domain you want to register
       `domain_proxy_client.register` # Call the .register method to create an account on the domain node
    

User Registration Flow

User has url to the domain

User successfully register on the domain

  • [ ] user calls sy.register
  • [ ] user enters a valid name
  • [ ] user enters a valid email address
  • [ ] user enters a valid password
  • [ ] user enters a valid url to the domain
  • [ ] user enters a valid port (Optional)
  • [ ] user sees a successful registration message
    ongratulations !!! Sheldon Cooper is successfully registered to the Canada Domain node. Logging in....Success.
    
  • [ ] user receives an authenticated domain client object

Registration is unsuccessful

  • [ ] user tries to register with an email that is linked to some other user
    esourceExists: 
    A user with this email already exists on the Canada Domain node. 
    You can try logging in by:
    
        import syft as sy 
        sy.login( 
            url="https://domainurl.com",  # Enter your domain url 
            email="[email protected]",  # Enter your email address 
            password="password",  # Enter your password 
            port=8081  # Enter domain port number 
        )
    
  • [ ] user enters an invalid email
    alidationError:
    	Invalid email. Make sure your email is in a `[email protected]` format
    
  • [ ] user does not enter the name or name field is blank
    alidationError:
    	Invalid name. Name cannot be an empty string.
    
  • [ ] user enters empty string as password
    alidationError:
       Invalid password. Password cannot be an empty string.
    
  • [ ] user tries to register but either the domain url/port is incorrect or the domain is offline
    onnectionError:
       Oops !!! We can't seem to find the domain you're looking for.
       Please try the following options:
       - Please check the `url`/`port` you entered are correct.
       - Please contact the source where you obtained the URL.
       - The domain node could be offline at the current moment. Please try again later.
    

User access a domain via the network

User successfully register to the domain

  • [ ] user lists all networks
  • [ ] user selects a network and receives a proxy client object
  • [ ] user lists all domain
  • [ ] user selects a domain and gets a proxy client object
  • [ ] user calls .register on the domain proxy client
  • [ ] user enters a valid name
  • [ ] user enters a valid email address
  • [ ] user enters a valid password
  • [ ] user sees a successful registration message
    ongratulations !!! Sheldon Cooper is successfully registered to the Canada Domain node. Logging in....Success.
    
  • [ ] user receives an authenticated domain client object

Registration is unsuccessful

  • [ ] user tries to register with an email that is linked to some other user
    esourceExists:
       A user with this email already exists on the Canada Domain node.
       You can try logging in by:
    
           import syft as sy
           network = sy.networks[0]  # Select the network
           domain_proxy_client = network.domains[0]  # Select the domain
           domain_proxy_client.login(email="youremailaddress", password="yourpassword")
    
  • [ ] user enters an invalid email
    alidationError:
    	Invalid email. Make sure your email is in a `[email protected]` format
    
  • [ ] user does not enter the name or name field is blank
    alidationError:
    	Invalid name. Name cannot be an empty string.
    
  • [ ] user enters empty string as password
    alidationError:
       Invalid password. Password cannot be an empty string.
    
    

shubham3121 avatar Mar 25 '22 12:03 shubham3121