Example #1
0
 def test_get_coordinates(self):
     """Get location from redis"""
     self.r.lpush('BOT_STATUS.location', self.coordinates[2])
     self.r.lpush('BOT_STATUS.location', self.coordinates[1])
     self.r.lpush('BOT_STATUS.location', self.coordinates[0])
     self.assertEqual(ENV.redis_load('location', other_redis=self.r),
                      self.coordinates)
Example #2
0
 def getcoordinates(self, test_coordinates=False):
     """Get machine coordinates from bot."""
     location = ENV.redis_load('location')
     if location is None or test_coordinates:
         self.coordinates = self.test_coordinates  # testing coordintes
     else:
         self.coordinates = location  # current bot coordinates
Example #3
0
 def test_env_load(self):
     """Get user_env from redis"""
     self.r.set('BOT_STATUS.user_env.testkey', self.testvalue)
     self.assertEqual(
         ENV.redis_load('user_env',
                        name='testkey',
                        get_json=False,
                        other_redis=self.r), self.testvalue)
Example #4
0
 def test_none_user_env_load(self):
     """Try to get a non-existant user_env from redis"""
     self.assertEqual(
         ENV.redis_load('user_env', name='doesntexist', other_redis=self.r),
         None)
Example #5
0
 def test_bad_json_env_load(self):
     """Try to get bad json user_env from redis"""
     self.r.set('BOT_STATUS.user_env.testdata', self.badjson_string)
     self.assertEqual(
         ENV.redis_load('user_env', name='testdata', other_redis=self.r),
         None)
Example #6
0
 def test_json_env_load(self):
     """Get json user_env from redis"""
     self.r.set('BOT_STATUS.user_env.testdata', json.dumps(self.testjson))
     self.assertEqual(
         ENV.redis_load('user_env', name='testdata', other_redis=self.r),
         self.testjson)
Example #7
0
 def test_not_coordinates(self):
     """Coordinates aren't a list"""
     self.r.set('BOT_STATUS.location', 'notalist')
     self.assertEqual(ENV.redis_load('location', other_redis=self.r), None)
Example #8
0
 def test_no_coordinates(self):
     """Coordinates don't exist"""
     self.assertEqual(ENV.redis_load('location', other_redis=self.r), None)