Exemplo n.º 1
0
 def __init__(self,
              driver_path="./driver/chromedriver",
              in_path="./data/data.txt",
              out_path="./data/unload_sucs.txt"):
     user_data = UserData()
     username, password = user_data.get_user_data(0)
     super().__init__(driver_path, in_path, out_path, username, password)
Exemplo n.º 2
0
 def __init__(self,
              driver_path="./driver/send",
              in_path="./data/data.txt",
              out_path="./data/send_sucs.txt"):
     user_data = UserData()
     username, password = user_data.get_user_data(1)
     super().__init__(driver_path, in_path, out_path, username, password)
Exemplo n.º 3
0
 def __init__(self, driver_path="./driver/receive"):
     user_data = UserData()
     username, password = user_data.get_user_data(0)
     super().__init__(driver_path=driver_path,
                      in_path="",
                      out_path="",
                      username=username,
                      password=password)
Exemplo n.º 4
0
    def test_copy_password(self):
        '''
        Test to confirm that we are copying the email address from a found contact
        '''

        self.new_userdata.save_account()
        UserData.copy_password(1, 1)

        self.assertEqual(self.new_userdata.account_key, pyperclip.paste())
Exemplo n.º 5
0
    def test_display_data(self):
        '''
        test_display_data test case used to test if the function displays the data
        '''
        self.new_userdata.save_account()
        test_data = UserData(2, 2, "Test", "admintest")

        test_data.save_account()
        display_data = UserData.display_data(2, 2)
        self.assertEqual(test_data.account_name, display_data.account_name)
Exemplo n.º 6
0
    def test_data_exists(self):
        '''
        test_data_exists test case to test if the the function checks that the data exists
        '''

        self.new_userdata.save_account()
        test_data = UserData(2, 2, "Test", "admintest")

        test_data.save_account()
        data_exists = UserData.data_exists(2)
        self.assertTrue(data_exists)
Exemplo n.º 7
0
 def __init__(self,
              driver_path="./driver/chromedriver.exe",
              in_path="./data/data.txt",
              out_path="./data/submit_sucs.txt"):
     user_data = UserData()
     username, password = user_data.get_user_data(0)
     super().__init__(driver_path,
                      in_path,
                      out_path,
                      username,
                      password,
                      need_upload=True)
Exemplo n.º 8
0
    def prepareGame(self):
        if self.camera:
            # Disable Mouse Control for camera
            self.disableMouse()

            self.camera.setPos(0, 0, 500)
            self.camera.lookAt(0, 0, 0)

        self.gameData = GameData(True)

        # game data
        self.broadcastData(('gamedata', self.gameData.packageData()))
        self.broadcastData(('state', 'preround'))
        print "Preparing Game"
        self.gameTime = 0
        self.tick = 0

        usersData = []
        for user in self.currentPlayers:
            user.gameData = UserData()
            usersData.append(user.gameData)
        print usersData
        self.game = Game(self, usersData, self.gameData)
        self.taskMgr.doMethodLater(0.5, self.roundReadyLoop, 'Game Loop')
        print "Round ready State"
Exemplo n.º 9
0
	def doAdd(self, evt):
		wildcard = "STL (*.stl)|*.stl;*.STL|"	 \
			"All files (*.*)|*.*"
			
		dlg = wx.FileDialog(
			self, message="Choose an STL file",
			defaultDir=self.settings.lastdirectory, 
			defaultFile="",
			wildcard=wildcard,
			style=wx.FD_OPEN)

		rc = dlg.ShowModal()
		if rc == wx.ID_OK:
			path = dlg.GetPath().encode('ascii','ignore')
		dlg.Destroy()
		if rc != wx.ID_OK:
			return
		
		self.settings.lastdirectory = os.path.dirname(path)
		
		if self.settings.preview:
			stlObj = stl(filename = path)
			dlg = StlViewer(self, stlObj, path, True, self.images, self.settings)
			rc = dlg.ShowModal()
			dlg.Destroy()
			dlg = None
		
		if not self.settings.preview or rc == wx.ID_OK:
			ud = UserData(path, stlObj, self.seq)
			self.files.addFile(ud)
			self.stlCanvas.addHull(stlObj, self.seq)
			self.seq += 1
			self.modified = True
			self.enableButtons()
Exemplo n.º 10
0
    def __init__(self, showbase):
        DirectObject.__init__(self)

        # Initialise Window
        self.showbase = showbase

        # total time since start of game, to keep ticks updating on time (rather, not before)
        self.totalTime = 0

        # packets queue
        self.incoming = deque()

        users = []
        for user in self.showbase.users:
            user.gameData = UserData(user.name == self.showbase.username)
            users.append(user.gameData)
        self.game = Game(self.showbase, users, self.showbase.gameData)
        self.gameHandler = GameHandler(self.showbase, self.game)

        self.tick = 0
        self.tempTick = 0

        # Set event handlers for keys
        # self.showbase.accept("escape", sys.exit)

        # send loading completion packet to the game server
        self.showbase.client.sendData(('round', 'sync'))

        # Add the game loop procedure to the task manager.
        self.showbase.taskMgr.add(self.gameLoop, 'Game Loop')
Exemplo n.º 11
0
	def splitUpdate(self, evt):
		finished = False
		if evt.state == SPLIT_LAST_OBJECT:
			finished = True
			if self.part == 0:
				dlg = wx.MessageDialog(self,
					"Object consists of a single mesh",
					"Cannot Split",
					wx.OK | wx.ICON_EXCLAMATION)
				dlg.ShowModal()
				dlg.Destroy()
				self.splitter = None
				self.enableButtons()
				return
			
		nf = evt.facets
		if self.part == 0:
			ud = self.files.getSelection()
			ud.getStlObj().setFacets(nf)
			ud.setPart(self.part)
			self.files.refreshFilesList(ud.getSeqNbr())
			self.stlCanvas.refreshHull(ud.getSeqNbr())
		else:
			nobj = stl(filename=None)
			nobj.setFacets(nf)
			ud = UserData(self.partfn, nobj, self.seq)
			ud.setPart(self.part)
			self.files.addFile(ud)
			self.stlCanvas.addHull(nobj, self.seq)
			self.seq += 1
			
		self.part += 1
		
		if finished:
			self.modified = True
			self.splitter = None
			self.enableButtons()
		else:
			self.disableButtons()
Exemplo n.º 12
0
 def saveUserData(self):
     """Save the user data, if any of it has changed during the run time."""
     # if for any reason the first update hasn't commenced - don't save anything
     if self.api.username is None:
         return
     # if the session is set to be stored - serialize it
     # if it is also dirty - set the flag for a check later
     session_pkl = 'null'
     session_isDirty = False
     if Options.get('rememberLogin'):
         session_pkl = self.api.storeSession()
         if self.api.isDirty:
             session_isDirty = True
     # if there is no need to save anything - stop right there too
     if not (any([db.isDirty for db in self.databases])
             or any([ps.isDirty for ps in self.presenters])
             or Options.isDirty or session_isDirty):
         return
     # construct the UserData object
     serialized_data = UserData(
         username=self.api.username,
         movies_conf=self.presenters[0].storeToString(),
         movies_data=self.databases[0].storeToString(),
         series_conf=self.presenters[1].storeToString(),
         series_data=self.databases[1].storeToString(),
         games_conf=self.presenters[2].storeToString(),
         games_data=self.databases[2].storeToString(),
         options_json=Options.storeToString(),
         session_pkl=session_pkl,
     )
     # request the manager to save it
     self.dataManager.save(serialized_data)
     # notify the objects that they were saved
     for db in self.databases:
         db.isDirty = False
     for ps in self.presenters:
         ps.isDirty = False
     Options.isDirty = False
     self.api.isDirty = False
Exemplo n.º 13
0
 def setUp(self):
     '''
     Function to set initial variables for testing
     '''
     self.new_userdata = UserData(1, 1, "Yelp", "adminpass")
Exemplo n.º 14
0
class JiraAction():
    open_statuses = []
    homedir = expanduser("~")
    jira = None
    userdata = UserData()

    def setup(self):
        if self.jira == None:
            with open(homedir + "/.jirator/config") as fh:
                data = json.load(fh)
            options = {"server": data["server"]}
            self.jira = JIRA(options=options,
                             basic_auth=(data["username"], data["password"]))
            for s in data["status"]:
                app = '\"' + s + '\"'
                self.open_statuses.append(app)

    def fetch_open_issues(self):
        statuses = ",".join(self.open_statuses)
        my_issues = self.jira.search_issues(
            'assignee=currentUser() and status in (' + statuses + ')')
        return my_issues

    def save_or_return_dtid(self, issuekey):
        sdtid = self.userdata.default_transition_id()

        if sdtid is not None:
            return sdtid

        print(
            "Could not find any default transition id for this issue; please select one to use as the default 'in progress' transition:\n"
        )

        trs = self.jira.transitions(issuekey)
        for idx, t in enumerate(trs):
            tch = t["to"]
            d = "no description" if not tch["description"] else tch[
                "description"]
            print("\t%d) %s (%s)" % (idx + 1, tch["name"], d))

        selected = 0
        while True:
            try:
                sel = int(
                    input(
                        "\nPlease specify the number of the transition you want to use as default: "
                    ))
                if (sel >= 1) and (sel <= len(trs)):
                    selected = sel
                    break
                print("Please enter a number between %d and %d" %
                      (1, len(trs)))
            except:
                print("Please enter a number between %d and %d" %
                      (1, len(trs)))

        tid = trs[selected - 1]
        self.userdata.save_default_tid(tid["id"])
        return tid["id"]

    def assign_issue_to_self(self, issuekey):
        logging.debug("assigning %s to self" % (issuekey))
        dtid = self.userdata.default_transition_id()
        if dtid == None:
            logging.debug("could not find any default tid")
        else:
            logging.debug("using '%s' as tid" % (dtid))

        try:
            myself = self.jira.myself()
            issue = self.jira.issue(issuekey)
            tid = self.save_or_return_dtid(issuekey)
            issue.update(assignee={'name': myself["name"]})
            subprocess.call(["git", "checkout", "-b", issuekey])
        except JIRAError as e:
            logging.error("could not assign issue '%s' to self: '%s'" %
                          (issuekey, e.text))
Exemplo n.º 15
0
from kivy.clock import Clock
from userdata import UserData
from usergamedata import UserGameData
from random import randint
from time import sleep

# made for iPhone 7 Plus size
from kivy.config import Config
Config.set('graphics', 'resizable', False)
Config.set('graphics', 'width', '550')
Config.set('graphics', 'height', '306')

kv = Builder.load_file('game.kv')

#databases
db = UserData('userdata.txt')
gdb = UserGameData('usergamedata.txt')

#global variables
userID = ''
avatar = 0
pet = 0
lvlChosen = 1
currentLvlData = [None,None,None,None,100] #x_coord, y_coord, mazeData, knightsLeft, heroHP

class LoginPage(Screen):
    user = ObjectProperty(None)
    passw = ObjectProperty(None)
    
    def LoginBtn(self):
        if self.user.text == '' or self.passw.text == '':
Exemplo n.º 16
0
class TestUserData(unittest.TestCase):
    '''
    This is a test class that tests cases for creating and authenticating user data
    '''
    def setUp(self):
        '''
        Function to set initial variables for testing
        '''
        self.new_userdata = UserData(1, 1, "Yelp", "adminpass")

    def tearDown(self):
        '''
        tear down function does clean up after each test case
        '''
        UserData.users_list = []

    def test_init(self):
        '''
        test_init test case to check if objects initialized properly
        '''
        self.assertEqual(self.new_userdata.user_identity, 1)
        self.assertEqual(self.new_userdata.data_identity, 1)
        self.assertEqual(self.new_userdata.account_name, "Yelp")
        self.assertEqual(self.new_userdata.account_key, "adminpass")

    def test_save_account(self):
        '''
        test_save_account test case to test if userdata object is saved into users_list
        '''
        self.new_userdata.save_account()  #create and save new_cred
        self.assertEqual(len(UserData.users_list), 1)

    def test_password_generator(self):
        '''
        test_password_generator test case to test if password has been generated and saved
        '''
        password_list = []

        password = self.new_userdata.password_generator(2)
        password_list.append(password)
        self.assertEqual(len(password_list), 1)

    def test_data_exists(self):
        '''
        test_data_exists test case to test if the the function checks that the data exists
        '''

        self.new_userdata.save_account()
        test_data = UserData(2, 2, "Test", "admintest")

        test_data.save_account()
        data_exists = UserData.data_exists(2)
        self.assertTrue(data_exists)

    def test_display_data(self):
        '''
        test_display_data test case used to test if the function displays the data
        '''
        self.new_userdata.save_account()
        test_data = UserData(2, 2, "Test", "admintest")

        test_data.save_account()
        display_data = UserData.display_data(2, 2)
        self.assertEqual(test_data.account_name, display_data.account_name)

    def test_copy_password(self):
        '''
        Test to confirm that we are copying the email address from a found contact
        '''

        self.new_userdata.save_account()
        UserData.copy_password(1, 1)

        self.assertEqual(self.new_userdata.account_key, pyperclip.paste())
Exemplo n.º 17
0
 def addCard(self, user, cardNum, limit):
     if self.luhncheck(cardNum) and int(limit.replace("$", "")) >= 0:
         self.myDB[user] = UserData(cardNum, int(limit.replace("$", "")))
     else:
         self.myDB[user] = UserData(cardNum, "error", "error")
Exemplo n.º 18
0
#!/usr/bin/env/ python3

import json
from pymongo import MongoClient

from userdata import UserData
from cryptopiauserget import CryptopiaUserGet
from userdatabase import CreateUser

#mongoClient = MongoClient("mongodb://*****:*****@userwallet-shard-00-00-2tbmf.mongodb.net:27017,userwallet-shard-00-01-2tbmf.mongodb.net:27017,userwallet-shard-00-02-2tbmf.mongodb.net:27017/admin?replicaSet=UserWallet-shard-0&ssl=true")

mongoClient = MongoClient(
    "mongodb://*****:*****@cluster01-shard-00-00-oheid.mongodb.net:27017,cluster01-shard-00-01-oheid.mongodb.net:27017,cluster01-shard-00-02-oheid.mongodb.net:27017/admin?replicaSet=Cluster01-shard-0&ssl=true"
)

userData = UserData()

cuGet = CryptopiaUserGet()

createUser = CreateUser()

#createUser.Insert()

#createUser.AddNewUser()
#createUser.AddMultipleUsers()

#run wallet
mongoDB = mongoClient['user']

users = mongoDB['wallet'].find({}, {
    'email': 1,