import RESTBackMeUp as BMU

TWITTER_AUTH_DATA = {
  "secret" : "WYnjIW2ymHBXI4IjPUubaeSgxaMtQ3gEv8bFdGsN7lQ",
  "oauth_token" : "n7MgvbBnL2keYejuC0FePAFuAsXmzC6P5BpeFqCZs",
  "oauth_verifier" : "igLr5JsgmQlxNcQXFoAtcFAWZoilwLPHbw1OFuRkIM",
  "token" : "843501650-3eU0c2txIX6rzNTNaPXEmHcsN7qvu7drzNNo32Sz"
}

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

sinkId = BMU.auth_datasink("TestUser", "org.backmeup.dummy", "SrcProfile", "password").data["profileId"]
    
sourceId = BMU.auth_datasource("TestUser", "org.backmeup.twitter", "SinkProfile", "password").data["profileId"]
BMU.update_profile(sourceId, TWITTER_AUTH_DATA, "password");


res = BMU.create_backup_job("TestUser", "password", [sourceId], [], sinkId, "realtime", "Twitter to Dummy")

import RESTBackMeUp as BMU

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

sourceId = BMU.auth_datasource("TestUser", "org.backmeup.moodle", "SrcProfile", "password").data["profileId"]

BMU.update_profile(sourceId, {"Username" : "backmeup", "Password" : "286bafbb1a9faf4dc4e104a33e222304", "Moodle Server Url" : "http://gtn02.gtn-solutions.com/moodle20"}, "password");

sinkId = BMU.auth_datasink("TestUser", "org.backmeup.discmailing", "SinkProfile", "password").data["profileId"]

BMU.update_profile(sinkId, {"Street" : "Mariahilferstrasse 15", "City" : "Wien", "Postcode" : "1150"}, "password");

res = BMU.create_backup_job("TestUser", "password", [sourceId], ["org.backmeup.indexer", "org.backmeup.encryption"], sinkId, "daily", "Moodle to Discmail", {
	"org.backmeup.encryption.org.backmeup.encryption.password" : "myEncryptionPw"
	})

import RESTBackMeUp as BMU

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

SKYDRIVE_AUTH = {
  "secret" : "jvZDGQl1aUamXYJCpyqWCqncO5bxRpd-",
  "refreshToken" : "vEUNSAAAHgA%241uVUDAYSjCt!wxeimQCsIl!wCKVNQwvMzJl1ap9TawbDjQR1tAO7DW4rvd35HBKeMu2*svalqszcgJJDP3osO*W8e96SWsEp9oSEXxi!5vgEhoNnHkCPw2fLcgYyoHyOWzvxH4mdJ8C5toMdugYEcyKRZLJPR7BfC2",
  "token": "EwAoAq1DBAAUlbRWyAJjK5w968Ru3Cyt\/6GvwXwAAWEUR4uTb0I1nikK\/BOgJqORMRWmtnATWNyinXE47pLib87+hOTiv4kFkOlb86GwEzn69Mkup5v5Qpl4+E9OA5nVzm69ah9b6mMVlMDKqjGxdwLBxtrAi8\/kAfYh0eG+GT9gILR504RUYe5VKPYpdKBwTAvbdX9HCMct2v3oc4lG24ZMu3Z9MTXWQOOfIIFrD\/s2Mdwe\/pcZE1\/M2q6RrFEaBqKRLAEUEupmSn6TDCtTZZReAlCASjKguZPzjXm8K5icMp9ho3myLxZmDDWJZ7Jpn89QwoBLsw85wrEDOrjkrw+fpkjenQ55dzUfw9lwvzMJ\/jJsWd9qK10xX72+I6gDZgAACCCUMcDqmjjK+AAduBLN6yL4JDhjgh4nQjsP4r4pKN6fsnViobcnezTFBXyGalF7kG1T97iTjsOCxw4zR1r3b\/hIS+4aGwTlY8Z\/OSU2jqprEe6IH6Ccvpm6pT8RqFta3ODOrx1XuEBMN9e4bTbmyivzKePGLVZTa4pDWfmBwWL9qyPv\/JWXj0wqFHo6Wj4ExUG1EpjpsN807BSoplKoMQSU7izU8SOadak4T0OStHhCzSwZi6jpIQYnUuDF8Ja9cuScbnthS2wywST3yPRmKaZFLullgbqyJ1QpVkMkgQufef4eOZ+cABdfootlrtaA5J2kfHxoeW\/76lnr1sZ\/T0DfyAAA",
  "key" : "00000000480D45BC",
  "code" : "aedfdc21-d223-2fe7-d186-74f8c70ffa3b",
  "callback" : "http://www.backmeup.at/"
}

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

sinkId = BMU.auth_datasink("TestUser", "org.backmeup.skydrive", "SrcProfile", "password").data["profileId"]

BMU.update_profile(sinkId, SKYDRIVE_AUTH, "password");

sourceId = BMU.auth_datasource("TestUser", "org.backmeup.dummy", "SinkProfile", "password").data["profileId"]

res = BMU.create_backup_job("TestUser", "password", [sourceId], [], sinkId, "realtime", "Dummy to Skydrive")

#!/usr/bin/python

import RESTBackMeUp as BMU

appKey = "4pheai3cd0btkd5"
appSecret = "0sjcpoqe1jeqlat"


BMU.delete_user("Seppl")
res = BMU.register_user("Seppl", "SepplSeppl", "SepplSeppl", "*****@*****.**")
print res.data
BMU.verify_email(res.data["verificationKey"])
res = BMU.auth_datasink("Seppl", "org.backmeup.dropbox", "Dropbox", "SepplSeppl")
sinkId = res.data["profileId"]
res = BMU.update_profile(sinkId, {"token" : appKey, "secret" : appSecret}, "SepplSeppl")
res = BMU.auth_datasource("Seppl", "org.backmeup.dropbox", "Dropbox", "SepplSeppl")
sourceId = res.data["profileId"]
res = BMU.update_profile(sourceId, {"token" : appKey, "secret" : appSecret}, "SepplSeppl")
res = BMU.create_backup_job("Seppl", "SepplSeppl", [sourceId], None, sinkId, "daily", "Dropbox to Dropbox")


}

WRONG_TWITTER_AUTH_DATA = {
  "secret" : "WYnjIW2ymHBXI4IjPUubaeSgxaMtQ3gEv8bFdGsN7lQxxxx",
  "oauth_token" : "n7MgvbBnL2keYejuC0FePAFuAsXmzC6P5BpeFqCZsxxxx",
  "oauth_verifier" : "igLr5JsgmQlxNcQXFoAtcFAWZoilwLPHbw1OFuRkIMxxxx",
  "token" : "843501650-3eU0c2txIX6rzNTNaPXEmHcsN7qvu7drzNNo32Szxxxx"
}

DROPBOX_AUTH_DATA = {
  "token":"thhc9we93cwk78s", "secret":"656rwxei8vf7i5v"
}

WRONG_DROPBOX_AUTH_DATA = {
  "token":"ABCthhc9we93cwk78s", "secret":"ABC656rwxei8vf7i5v"
}

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

sinkId = BMU.auth_datasink("TestUser", "org.backmeup.dropbox", "SinkProfile", "password").data["profileId"]
BMU.update_profile(sinkId, WRONG_DROPBOX_AUTH_DATA, "password");
    
sourceId = BMU.auth_datasource("TestUser", "org.backmeup.twitter", "SinkProfile", "password").data["profileId"]
BMU.update_profile(sourceId, WRONG_TWITTER_AUTH_DATA, "password");


res = BMU.create_backup_job("TestUser", "password", [sourceId], ["org.backmeup.indexer"], sinkId, "daily", "Twitter to Dropbox")
print res
import RESTBackMeUp as BMU

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

SKYDRIVE_AUTH = {
  "secret" : "jvZDGQl1aUamXYJCpyqWCqncO5bxRpd-",
  "refreshToken" : "vEUNSAAAHgA%241uVUDAYSjCt!wxeimQCsIl!wCKVNQwvMzJl1ap9TawbDjQR1tAO7DW4rvd35HBKeMu2*svalqszcgJJDP3osO*W8e96SWsEp9oSEXxi!5vgEhoNnHkCPw2fLcgYyoHyOWzvxH4mdJ8C5toMdugYEcyKRZLJPR7BfC2",
  "token": "EwAoAq1DBAAUlbRWyAJjK5w968Ru3Cyt\/6GvwXwAAWEUR4uTb0I1nikK\/BOgJqORMRWmtnATWNyinXE47pLib87+hOTiv4kFkOlb86GwEzn69Mkup5v5Qpl4+E9OA5nVzm69ah9b6mMVlMDKqjGxdwLBxtrAi8\/kAfYh0eG+GT9gILR504RUYe5VKPYpdKBwTAvbdX9HCMct2v3oc4lG24ZMu3Z9MTXWQOOfIIFrD\/s2Mdwe\/pcZE1\/M2q6RrFEaBqKRLAEUEupmSn6TDCtTZZReAlCASjKguZPzjXm8K5icMp9ho3myLxZmDDWJZ7Jpn89QwoBLsw85wrEDOrjkrw+fpkjenQ55dzUfw9lwvzMJ\/jJsWd9qK10xX72+I6gDZgAACCCUMcDqmjjK+AAduBLN6yL4JDhjgh4nQjsP4r4pKN6fsnViobcnezTFBXyGalF7kG1T97iTjsOCxw4zR1r3b\/hIS+4aGwTlY8Z\/OSU2jqprEe6IH6Ccvpm6pT8RqFta3ODOrx1XuEBMN9e4bTbmyivzKePGLVZTa4pDWfmBwWL9qyPv\/JWXj0wqFHo6Wj4ExUG1EpjpsN807BSoplKoMQSU7izU8SOadak4T0OStHhCzSwZi6jpIQYnUuDF8Ja9cuScbnthS2wywST3yPRmKaZFLullgbqyJ1QpVkMkgQufef4eOZ+cABdfootlrtaA5J2kfHxoeW\/76lnr1sZ\/T0DfyAAA",
  "key" : "00000000480D45BC",
  "code" : "aedfdc21-d223-2fe7-d186-74f8c70ffa3b",
  "callback" : "http://www.backmeup.at/"
}

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

sourceId = BMU.auth_datasource("TestUser", "org.backmeup.skydrive", "SrcProfile", "password").data["profileId"]

BMU.update_profile(sourceId, SKYDRIVE_AUTH, "password");

sinkId = BMU.auth_datasink("TestUser", "org.backmeup.dummy", "SinkProfile", "password").data["profileId"]

res = BMU.create_backup_job("TestUser", "password", [sourceId], [], sinkId, "realtime", "Skydrive To Dummy")

import RESTBackMeUp as BMU

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

sinkId = BMU.auth_datasink("TestUser", "org.backmeup.dummy", "SrcProfile", "password").data["profileId"]
    
sourceId = BMU.auth_datasource("TestUser", "org.backmeup.dropbox", "SinkProfile", "password").data["profileId"]
BMU.update_profile(sourceId, {"token":"thhc9we93cwk78s", "secret":"656rwxei8vf7i5v"}, "password");


res = BMU.create_backup_job("TestUser", "password", [sourceId], [], sinkId, "realtime", "TestUserJob")

import RESTBackMeUp as BMU

BMU.delete_user("TestUser")
res = BMU.register_user("TestUser", "password", "password", "*****@*****.**")
BMU.verify_email(res.data["verificationKey"])

sourceId = BMU.auth_datasource("TestUser", "org.backmeup.dummy", "SrcProfile", "password").data["profileId"]

sinkId = BMU.auth_datasink("TestUser", "org.backmeup.discmailing", "SinkProfile", "password").data["profileId"]

BMU.update_profile(sinkId, {"Street" : "Mariahilferstrasse 15", "City" : "Wien", "Postcode" : "1150"}, "password");

res = BMU.create_backup_job("TestUser", "password", [sourceId], [], sinkId, "realtime", "Dummy to Discmailing")