Exemplo n.º 1
0
 def test_filtered_ordered_query_filter_no_field(self):
     # Create OsProfile
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with invalidFilterField
     filters = {'invalidFilterField': 'SomeValue'}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Exemplo n.º 2
0
 def test_filtered_ordered_query_deleted_no_field(self):
     # Create OsProfile which do not have deleted field
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with deleted
     filters = {'deleted': False}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Exemplo n.º 3
0
 def test_filtered_ordered_query_changessince_no_field(self):
     # Create OsProfile which do not have lastModifiedEpoch field
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with changes-since
     now = long(time.time() * 1000L)
     filters = {'changes-since': now}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Exemplo n.º 4
0
 def test_filtered_ordered_query_filter_no_field(self):
     # Create OsProfile
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with invalidFilterField
     filters = {'invalidFilterField': 'SomeValue'}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Exemplo n.º 5
0
 def test_filtered_ordered_query_deleted_no_field(self):
     # Create OsProfile which do not have deleted field
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with deleted
     filters = {'deleted': False}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Exemplo n.º 6
0
 def test_filtered_ordered_query_changessince_no_field(self):
     # Create OsProfile which do not have lastModifiedEpoch field
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with changes-since
     now = long(time.time() * 1000L)
     filters = {'changes-since': now}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)