Exemplo n.º 1
0
    def testGetUnclassifiedSectionsFiltered(self):
        """
    Tests that queryUnclassifiedSections never returns 
    a section with section['retained'] == False. A section is only returned if 
    section['retained'] == True  and all other query conditions are met    
    """
        # Clear previous Stage_Sections data and load new data
        # specific to filtering
        self.SectionsColl.remove()
        load_database_json.loadTable(self.serverName, "Stage_Sections",
                                     "tests/data/testFilterFile")
        tests.common.updateSections(self)
        # Extra updates to Sections necessary for testing filtering
        for section in self.SectionsColl.find():
            section['section_start_point'] = "filler start point"
            section['section_end_point'] = "filler end point"
            self.SectionsColl.save(section)

        from dao.user import User
        fakeEmail = "*****@*****.**"

        client = Client("testclient")
        client.update(createKey=False)
        tests.common.makeValid(client)

        (resultPre,
         resultReg) = client.preRegister("this_is_the_super_secret_id",
                                         fakeEmail)
        self.assertEqual(resultPre, 0)
        self.assertEqual(resultReg, 1)

        user = User.fromEmail(fakeEmail)
        self.assertEqual(user.getFirstStudy(), 'testclient')

        unclassifiedSections = tripManager.getUnclassifiedSections(
            User.fromEmail(fakeEmail).uuid)['sections']
        # Check that of the valid sections in the testFilterFile (2/3), only one of them is returned by the query
        self.assertEqual(len(unclassifiedSections), 1)
        # Check that the second entry in the testFilterFile is the only section
        # that is loaded into the database
        self.assertEqual('20140401T095742-0700',
                         unclassifiedSections[0]['trip_id'])
Exemplo n.º 2
0
  def testGetUnclassifiedSectionsFiltered(self):
    """
    Tests that queryUnclassifiedSections never returns 
    a section with section['retained'] == False. A section is only returned if 
    section['retained'] == True  and all other query conditions are met    
    """
    # Clear previous Stage_Sections data and load new data
    # specific to filtering
    self.SectionsColl.remove()
    load_database_json.loadTable(self.serverName, "Stage_Sections", "tests/data/testFilterFile")   
    tests.common.updateSections(self) 
    # Extra updates to Sections necessary for testing filtering
    for section in self.SectionsColl.find():
      section['section_start_point'] = "filler start point"
      section['section_end_point'] = "filler end point"   
      self.SectionsColl.save(section)

    from dao.user import User
    fakeEmail = "*****@*****.**"

    client = Client("testclient")
    client.update(createKey = False)
    tests.common.makeValid(client)

    (resultPre, resultReg) = client.preRegister("this_is_the_super_secret_id", fakeEmail)
    self.assertEqual(resultPre, 0)
    self.assertEqual(resultReg, 1)

    user = User.fromEmail(fakeEmail)
    self.assertEqual(user.getFirstStudy(), 'testclient')

    unclassifiedSections = tripManager.getUnclassifiedSections(User.fromEmail(fakeEmail).uuid)['sections']
    # Check that of the valid sections in the testFilterFile (2/3), only one of them is returned by the query
    self.assertEqual(len(unclassifiedSections), 1)
    # Check that the second entry in the testFilterFile is the only section 
    # that is loaded into the database
    self.assertEqual('20140401T095742-0700',unclassifiedSections[0]['trip_id'])                     
Exemplo n.º 3
0
def getUnclassifiedSections():
  user_uuid=getUUID(request)
  return tripManager.getUnclassifiedSections(user_uuid)
Exemplo n.º 4
0
def getUnclassifiedSections():
  user_uuid=getUUID(request)
  return tripManager.getUnclassifiedSections(user_uuid)